cmake_minimum_required(VERSION 3.18.2)
project(threadpool)

# 设置编译器（可选的有gcc，g++）
set(CMAKE_CXX_COMPILER "g++")

# 设置编译选项
# 允许c++11标准、O3优化、多线程。match选项可避免一些cpu上的问题
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -march=native -O3 -pthread")

include_directories(${PROJECT_SOURCE_DIR}/threadpool)

# 设置用debug还是release模式。debug允许断点，而release更快
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)

#增加子文件夹(注意我们的src路径是通过子文件夹的形式添加的，在这里面也是可以些CMakeLists.txt的)
add_subdirectory(${PROJECT_SOURCE_DIR}/threadpool)
# ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/src)

# set(SOURCES src/Main.cpp)

aux_source_directory(./src DIR_SRCS)

add_executable(Main ${DIR_SRCS})
target_link_libraries(Main threadpool)

#设定可执行二进制文件的目录
# SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# execute_process(COMMAND make WORKING_DIRECTORY  ${PROJECT_SOURCE_DIR}/cbuild)
# execute_process(COMMAND ./Main WORKING_DIRECTORY  ${PROJECT_SOURCE_DIR}/bin)
